<?php
require_once ("cfginicial.php");

require_once(INCLUDE_DIR."/DBSetup.inc.php");

	require_once (INCLUDE_DIR."/funciones_generales.php");
	require_once (INCLUDE_DIR."/funciones_menues.php");
	require_once (INCLUDE_DIR."/funciones_sesion.php");

import('eyedatagrid');
import('eyepgsqladap');
//require 'class.eyepgsqladap.inc.php';
//require 'class.eyedatagrid.inc.php';


//function _mostrarContenido() {
// Load the database adapter
 $db = new EyePgSQLAdap(SERVIDOR, DBPORT, DBUSER, DBPASSW, DATABASE);

 // Load the datagrid class
 $x = new EyeDataGrid($db);

// Set the query, select all rows from the table cupo_lote
$x->setQuery("*", "t_cupo_lote","id");

// Change headers text
$x->setColumnHeader('terminal_id', 'Terminal');
$x->setColumnHeader('destinatario_id', 'Destinatario');

// Hide ID Column
$x->hideColumn('id');
$x->hideColumn('usuario_rol');
$x->hideColumn('tipousr');

//$x->setColumnType('apellido', EyeDataGrid::TYPE_FUNCTION, 'returnSomething', '%apellido%');

// Show reset grid control
$x->showReset();

// Add standard control
$x->addStandardControl(EyeDataGrid::STDCTRL_EDIT, "alert('Editing ID: %id%)')");
$x->addStandardControl(EyeDataGrid::STDCTRL_DELETE, "alert('Deleting ID: %id%')");

// Add custom control, order does matter
//$x->addCustomControl(EyeDataGrid::CUSCTRL_TEXT, "alert('%apellido%\'s been promoted!')", EyeDataGrid::TYPE_ONCLICK, 'Promote Me');
//$x->addCustomControl(EyeDataGrid::CUSCTRL_IMAGE, "alert('%apellido%\'s been promoted!')", EyeDataGrid::TYPE_ONCLICK, 'Me','images/reset.png');

// Add create control
$x->showCreateButton("alert('Code for creating a new person')", EyeDataGrid::TYPE_ONCLICK, 'Nuevo Lote de Cupos');

// Show checkboxes
$x->showCheckboxes();

// Show row numbers
$x->showRowNumber();
$x->allowFilters();
// Change the amount of results per page
$x->setResultsPerPage(10);

// Stop ordering
//$x->hideOrder();

         // Print the table
	fMostrarEncabezadoPagina($i18n->getKey("form.home.title"));         

   $x->printTable();
         
   fMostrarPiePagina();
//}

// Apply a function to a row
//----------------------------------------------Funciones -------------------------------------------------//
function returnSomething($lastname)
{
	return ($lastname);
}

?>
